{% extends 'empcms/super.html'%}
{% block temp_tit %}
     <title>register</title>
{% endblock %}

{% block  empcms%}
    <div id="content">
    {% load static %}
    <script type="text/javascript">
        function checkUsername(path){
            ajax_send(path,{"username":$("#username").val()},"get",$("#username_img"))
        }
        function submitForm(){
            var r=$("#checkval").val();
            if(r=="y"){
                $("#registerForm").submit();
            }else{
                console.log("数据不合法，无法提交！");
            }
        }
    </script>
        <p id="whereami">
        </p>
        <h1>
            注册
        </h1>
        <form id="registerForm" action="/userapp/register/register/" method="post"  enctype="multipart/form-data">
            {% csrf_token%}
            <table cellpadding="0" cellspacing="0" border="0"
                class="form_table">
                <tr>
                    <td valign="middle" align="right">
                        用户名:
                    </td>
                    <td valign="middle" align="left">
                        <input type="hidden" id="checkval" value=""/>
                        <input id="username" type="text" class="inputgri" name="username" onchange="checkUsername('{%url "user:checkName"%}')"/>
                        <img id="username_img" class="checkImg" src=""/>
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        真实姓名:
                    </td>
                    <td valign="middle" align="left">
                        <input type="text" class="inputgri" name="realname" />
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        密码:
                    </td>
                    <td valign="middle" align="left">
                        <input type="password" class="inputgri" name="password" />
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        性别:
                    </td>
                    <td valign="middle" align="left">
                        男
                        <input type="radio" class="inputgri" name="gender" value="1" checked="checked"/>
                        女
                        <input type="radio" class="inputgri" name="gender" value="0"/>
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        爱好:
                    </td>
                    <td valign="middle" align="left">
                        <input type="checkbox" name="hobby" value="football"/>足球
                        <input type="checkbox" name="hobby" value="basketball"/>篮球
                        <input type="checkbox" name="hobby" value="volleyball"/>排球
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        生日:
                    </td>
                    <td valign="middle" align="left">
                        <input type="text" class="inputgri" name="birth" placeholder="yyyy-mm-dd"/>
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="right">
                        头像:
                    </td>
                    <td valign="middle" align="left">
                        <input type="file" class="inputgri" name="user_pic" placeholder=""/>
                    </td>
                </tr>
            </table>
            <p>
{#                <input type="submit" class="button" value="提交 &raquo;" />#}
                <input type="button" class="button" onclick="submitForm()" value="提交 &raquo;" />
            </p>
        </form>
    </div>
{% endblock %}
